<?php
global $_RQ,$_AR;
$_RQ['op']=$_RQ['op']?$_RQ['op']:'set';
$return=array();
if($_RQ['op']=='set'){
	
	$item=$this->plugin_setting('totalnotice');
	$htmls=array(
		'type'=>'edit',
		'post'=>'totalset',
		'desc'=>'库存警报设置',
		'edit'=>array(
			array('type'=>'string','title'=>'库存少于','name'=>'total','help'=>'库存低于多少件后,每当减少库存时会推送一次库存警报,默认为5件'),
			array('type'=>'choose','title'=>'接收通知员工','name'=>'mid','action'=>'store.get_member','choose_title'=>'选择会员'),
		)
	);
	$return['htmls']=$htmls;
	$return['item']=$item;
	exi($return);
}
if($_RQ['op']=='totalset'){
	$post=get_postdata();	
	if(!$post['total'] ){
		exi('请填写库存','error');
	}
	$data=array('total'=>$post['total'],'mid'=>$post['mid']);
	$item=$this->plugin_setting('totalnotice',$data);
	exi('保存成功');
}
?>